import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {
    port: 8080,
    host: '0.0.0.0',
    open: true,
    allowedHosts: ['.cpolar.top'],
    proxy: {
      '/ollama': {
        target: 'http://192.168.251.118:11434', // 目标服务器地址
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/ollama/, ''),
      },
      '/anythingllm': {
        target: 'http://192.168.251.118:3001', // 目标服务器地址
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/anythingllm/, ''),
      },
    },
  },
  build: {
    outDir: 'dist',
  },
});